package org.xuyuji.DBtoBean.createFile;

import java.util.ArrayList;
import java.util.List;

public class GroupCreator {

	private static GroupCreator instance = new GroupCreator();
	
	private List<CreateFile> creators = new ArrayList<CreateFile>();
	
	private GroupCreator(){
		creators.add(new CreateBean());
		creators.add(new CreateXml());
		creators.add(new CreateDao());
		creators.add(new CreateDaoImpl());
	}
	
	public static GroupCreator getInstance(){
		return instance;
	}
	
	public void create(String tableName) throws Exception{
		for(CreateFile creator : creators){
			creator.create(tableName);
		}
	}
	
	public void create(String... tableNames) throws Exception{
		for(CreateFile creator : creators){
			for(String tableName : tableNames){
				creator.create(tableName);
			}
		}
	}
}
